package com.hw.core.system.repository;

import com.hw.core.system.entity.NoteBook;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface NoteBookRepository extends JpaRepository<NoteBook,Integer> {
    List<NoteBook> findNoteBookByStatusEquals(Integer status);
    @Query(value = "SELECT n FROM NoteBook n WHERE n.user.id =?1 and  n.name like %?2%")
    Page<NoteBook> findNoteBookByUserIs(Integer uid, String name, Pageable pageable);
    @Query(value = "SELECT n FROM NoteBook n WHERE n.user.id =?1")
    Page<NoteBook> findNoteBookByUserIs(Integer uid, Pageable pageable);

    Page<NoteBook> findNoteBookByNameLike(String name, Pageable pageable);
}
